
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<title><?php echo $WEBSITE['website_name']?>查看骑手位置</title>
<link href="webroot/shop/shop.css?v=<?php echo constant('JSCSS_VERSION')?>" type="text/css" rel="stylesheet">
<script src="webroot/common/jquery-1.12.1.min.js?v=<?php echo constant('JSCSS_VERSION')?>" type="text/javascript"></script>

<div class="pstz_order">
	<div class="content">
    	<div class="box">
        	<h3><?php echo Data::$_express_type[$express_type];?>快递单号：<?php echo $express_order_no;?></h3>
            <div class="com">
            	<dl>
                	<dd><img src="webroot/users/images/pstz_kdy.png"></dd>
                    <dt>
                    	<h4><?php echo $rider_name;?></h4>
                        <p><a href="<?php echo $rider_tel;?>"><?php echo $rider_tel;?></a></p>
                        <a class="dh" href="tel:021-62565633"><img src="webroot/users/images/pstz_dh.png"></a>
                    </dt>
                </dl>
                <div class="right">
                	<h4><?php echo $express_code_desc;?></h4>
                    <p><?php echo $otime;?></p>
                </div>
            </div>
        </div>
    </div>
    <div class="content pstz_map" id="container" style="width: 100%;height: 700px;"></div>

</div>
<script type="text/javascript">
//$(document).ready(function(){
//	//地图容器高度
//	var pstz_map_h = $(window).height();
//	$(".pstz_map").height(pstz_map_h);
//	//选择地址
//	$(".address_map_bottom li").click(function(){
//		$(this).addClass("on").siblings().removeClass();
//	});
//});
//</script>

<script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=awyKDc8f6V29IXEMtXgyZoa093ey7R7z"></script>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=297ba6fa286c3af65142f0d2e6661af7"></script>
<script>
    'use strict';
    function seat(lng,lat,shop_no,express_order_no,express_type,shop_express_no,status){
        if(!lat || !lng || !shop_no || !express_order_no || !express_type || !shop_express_no){
            alert('订单资料异常！');
            return false;
        }
        let info = {shop_no:shop_no,express_order_no:express_order_no,express_type:express_type,shop_express_no:shop_express_no,status:status};
        $.ajax({
            url:'?md=shop&cl=ajax&at=getLocation',
            type:'post',
            dataType:'json',
            data:info,
            success:function (d) {
                if(d.status == 'success'){
                    console.log(d);
                    console.log('耗子尾汁');
                    if( express_type == 'ss' || express_type == 'uu'){
                        var map = new BMapGL.Map('container');
                        var  elng = 121.320018;
                        var  elat = 31.193525;

                        if(status == 5){
                            d.data.exp_lng = lng
                            d.data.exp_lat = lat
                            var marker2 = new BMapGL.Marker(new BMapGL.Point(d.data.exp_lng, d.data.exp_lat));

                        }else{
                            var myIcon2 = new BMapGL.Icon("webroot/file/imgs/car.png", new BMapGL.Size(52, 26));
                            var pt2 = new BMapGL.Point(d.data.exp_lng, d.data.exp_lat);
                            var marker2 = new BMapGL.Marker(pt2, {
                                icon: myIcon2
                            });
                            var marker3 = new BMapGL.Marker(new BMapGL.Point(lng, lat));
                            map.addOverlay(marker3);
                        }

                        map.centerAndZoom(new BMapGL.Point(d.data.exp_lng, d.data.exp_lat), 13);
                        map.enableScrollWheelZoom(true);

                        var marker1 = new BMapGL.Marker(new BMapGL.Point(d.data.slng, d.data.slat));


                        map.addOverlay(marker1);
                        map.addOverlay(marker2);
                    }else{
                        console.log(678)
                        let icon = 'webroot/file/imgs/car.png';
                        if(status == 5){
                            d.data.exp_lng = lng
                            d.data.exp_lat = lat
                            icon = '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png';
                        }

                        var marker_gd1,marker_gd2,marker_gd3, map_gd = new AMap.Map("container", {
                            resizeEnable: true,
                            // 在地图上添加点标记
                            center: [d.data.exp_lng, d.data.exp_lat],
                            zoom: 13
                        });
                        marker_gd1 = new AMap.Marker({
                            icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
                            position: [d.data.slng, d.data.slat],
                            offset: new AMap.Pixel(-13, -30)
                        });
                        marker_gd2 = new AMap.Marker({
                            icon: icon,
                            position: [d.data.exp_lng, d.data.exp_lat],
                            offset: new AMap.Pixel(-13, -30)
                        });
                        if(status != 5){
                            marker_gd3 = new AMap.Marker({
                                icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
                                position: [lng,lat],
                                offset: new AMap.Pixel(-13, -30)
                            });
                            marker_gd3.setMap(map_gd);

                        }
                        marker_gd1.setMap(map_gd);
                        marker_gd2.setMap(map_gd);
                    }

                }else{
                    alert(d.msg);
                }
            }
        })
    }
    seat('<?php echo $lng?>','<?php echo $lat?>','<?php echo $shop_no?>','<?php echo $express_order_no?>','<?php echo $express_type?>','<?php echo $shop_express_no?>','<?php echo $status?>');
</script>
